<template>
    <div>
      <img :src="oss.url !== null? oss.url: '@/assets/images/none.jpg'" alt="">
    </div>
</template>

<script>
  import {queryOssById} from '@/api/system/oss'

  export default {
    name: 'ImageShow',
    props: {
      ossId: null
    },
    data: function() {
      return {
        oss: null
      }
    },
    mounted() {
      if (null !== this.ossId && undefined !== this.ossId) {
        queryOssById(this.ossId).then(response => {
          if (response.data !== null) {
            this.oss = response.data;
          }
        })
      }
    },
    watch: {
      ossId: function(newValue, oldValue) {

        if (null !== newValue && undefined !== newValue) {
          queryOssById(newValue).then(response => {
            if (response.data !== null) {
              this.oss = response.data;
            }
          })
        }
      }
    }
  }
</script>

<style scoped>
  img {
    height: 100px;
    width: 100px;
    cursor: pointer;
    border-radius: 10px;
  }
</style>
